﻿#include <iostream>
//#define DEBUG

using std::cin;
using std::cout;
using std::endl;

int parent( int i ){ return ( (i - 1) / 2 ); }

int left( int i ){ return (2 * i + 1); }

int right( int i ){ return (2 * i + 2); }

template<class T>
int max( T ar[], int a, int b ){
    if( ar[a] > ar[b] ) return a;
    else return b;
}

template<class T>
void swap( T& a, T& b ){
    T temp;
    temp = a;
    a = b;
    b = temp;
}

template<class T>
void Build_heap( T ar[], int N ){
    for( int j = N/2; j >= 0; j-- ){
        heapify( ar, j, N );
    }
}

template<class T>
void heapify( T ar[], int i, int N ){
    if( left( i ) >= N ){
        #ifdef DEBUG
            cout << "left( i ) = " << left(i) << " N" << endl;
        #endif
        return;
    }

    if( right( i ) >= N ){

        #ifdef DEBUG
            cout << "right( i ) = " << right(i) << " > N" << endl;
        #endif

        if( ar[ left(i) ] > ar[i] ) swap<T>( ar[i], ar[ left(i) ] );
        return;
    }

    if( ar[ max(ar, left(i), right(i) ) ] > ar[i] ){
        int a = max( ar, left(i), right(i) );

        #ifdef DEBUG
            cout << "ar[ " << max(ar, left(i), right(i) ) << " ] = ar[ max(ar, left(i), right(i) ) > " << "ar[i] == " << ar[i] << endl;
        #endif

        swap<T>( ar[i], ar[ max( ar, left(i), right(i) ) ] );

        #ifdef DEBUG
            cout << "heapify called on a = " << a << endl;
        #endif

        heapify<T>( ar, a, N );
    }
}

template<class T>
void Heapsort( T ar[], int N ){
    Build_heap<T>( ar, N );
    for( int i = N - 1; i >= 0; i-- ){
        swap( ar[0] , ar[i] );
        heapify( ar, 0, i );
    }
}

int main(){
    const int maxx = 7;
    int a, i = 0, ar[maxx];
    for( ; i < maxx; i++ ){
       cin >> ar[i];
    }
    cout << endl;
    Heapsort<int>( ar, maxx );
    for( int j = 0; j < maxx; j++ ) cout << ar[j] << endl;
    return 0;
}
